Optimal. Leaf size=155 \[ \frac {11 A \text {ArcTan}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a-a \sec (c+d x)}}\right )}{4 \sqrt {a} d}-\frac {2 \sqrt {2} A \text {ArcTan}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {2} \sqrt {a-a \sec (c+d x)}}\right )}{\sqrt {a} d}+\frac {5 A \sin (c+d x)}{4 d \sqrt {a-a \sec (c+d x)}}+\frac {A \cos (c+d x) \sin (c+d x)}{2 d \sqrt {a-a \sec (c+d x)}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.24, antiderivative size = 155, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 5, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.147, Rules used = {4107, 4005,
3859, 209, 3880} \begin {gather*} \frac {11 A \text {ArcTan}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a-a \sec (c+d x)}}\right )}{4 \sqrt {a} d}-\frac {2 \sqrt {2} A \text {ArcTan}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {2} \sqrt {a-a \sec (c+d x)}}\right )}{\sqrt {a} d}+\frac {5 A \sin (c+d x)}{4 d \sqrt {a-a \sec (c+d x)}}+\frac {A \sin (c+d x) \cos (c+d x)}{2 d \sqrt {a-a \sec (c+d x)}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 3859
Rule 3880
Rule 4005
Rule 4107
Rubi steps
\begin {align*} \int \frac {\cos ^2(c+d x) (A+A \sec (c+d x))}{\sqrt {a-a \sec (c+d x)}} \, dx &=\frac {A \cos (c+d x) \sin (c+d x)}{2 d \sqrt {a-a \sec (c+d x)}}-\frac {\int \frac {\cos (c+d x) \left (-\frac {5 a A}{2}-\frac {3}{2} a A \sec (c+d x)\right )}{\sqrt {a-a \sec (c+d x)}} \, dx}{2 a}\\ &=\frac {5 A \sin (c+d x)}{4 d \sqrt {a-a \sec (c+d x)}}+\frac {A \cos (c+d x) \sin (c+d x)}{2 d \sqrt {a-a \sec (c+d x)}}+\frac {\int \frac {\frac {11 a^2 A}{4}+\frac {5}{4} a^2 A \sec (c+d x)}{\sqrt {a-a \sec (c+d x)}} \, dx}{2 a^2}\\ &=\frac {5 A \sin (c+d x)}{4 d \sqrt {a-a \sec (c+d x)}}+\frac {A \cos (c+d x) \sin (c+d x)}{2 d \sqrt {a-a \sec (c+d x)}}+(2 A) \int \frac {\sec (c+d x)}{\sqrt {a-a \sec (c+d x)}} \, dx+\frac {(11 A) \int \sqrt {a-a \sec (c+d x)} \, dx}{8 a}\\ &=\frac {5 A \sin (c+d x)}{4 d \sqrt {a-a \sec (c+d x)}}+\frac {A \cos (c+d x) \sin (c+d x)}{2 d \sqrt {a-a \sec (c+d x)}}+\frac {(11 A) \text {Subst}\left (\int \frac {1}{a+x^2} \, dx,x,\frac {a \tan (c+d x)}{\sqrt {a-a \sec (c+d x)}}\right )}{4 d}-\frac {(4 A) \text {Subst}\left (\int \frac {1}{2 a+x^2} \, dx,x,\frac {a \tan (c+d x)}{\sqrt {a-a \sec (c+d x)}}\right )}{d}\\ &=\frac {11 A \tan ^{-1}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {a-a \sec (c+d x)}}\right )}{4 \sqrt {a} d}-\frac {2 \sqrt {2} A \tan ^{-1}\left (\frac {\sqrt {a} \tan (c+d x)}{\sqrt {2} \sqrt {a-a \sec (c+d x)}}\right )}{\sqrt {a} d}+\frac {5 A \sin (c+d x)}{4 d \sqrt {a-a \sec (c+d x)}}+\frac {A \cos (c+d x) \sin (c+d x)}{2 d \sqrt {a-a \sec (c+d x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 2.27, size = 332, normalized size = 2.14 \begin {gather*} \frac {A e^{-i (c+d x)} \left (7+6 e^{-i (c+d x)}+7 e^{i (c+d x)}+e^{-2 i (c+d x)}+6 e^{2 i (c+d x)}+e^{3 i (c+d x)}-11 i d \sqrt {1+e^{2 i (c+d x)}} x+11 \sqrt {1+e^{2 i (c+d x)}} \sinh ^{-1}\left (e^{i (c+d x)}\right )+16 \sqrt {2} \sqrt {1+e^{2 i (c+d x)}} \log \left (1-e^{i (c+d x)}\right )+11 \sqrt {1+e^{2 i (c+d x)}} \log \left (1+\sqrt {1+e^{2 i (c+d x)}}\right )-16 \sqrt {2} \sqrt {1+e^{2 i (c+d x)}} \log \left (1+e^{i (c+d x)}+\sqrt {2} \sqrt {1+e^{2 i (c+d x)}}\right )\right ) \sec (c+d x) \left (\cos \left (\frac {1}{2} (c+d x)\right )+i \sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{8 d \sqrt {a-a \sec (c+d x)}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(366\) vs.
\(2(130)=260\).
time = 8.88, size = 367, normalized size = 2.37
method | result | size |
default | \(-\frac {A \left (-1+\cos \left (d x +c \right )\right )^{2} \left (16 \left (-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}\right )^{\frac {3}{2}} \sqrt {2}\, \cos \left (d x +c \right )-6 \sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sqrt {2}\, \left (\cos ^{3}\left (d x +c \right )\right )+16 \left (-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}\right )^{\frac {3}{2}} \sqrt {2}-27 \sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sqrt {2}\, \left (\cos ^{2}\left (d x +c \right )\right )-4 \sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sqrt {2}\, \cos \left (d x +c \right )-48 \sqrt {2}\, \cos \left (d x +c \right ) \arctan \left (\frac {1}{\sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}}\right )-15 \sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sqrt {2}-48 \sqrt {2}\, \arctan \left (\frac {1}{\sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}}\right )-66 \cos \left (d x +c \right ) \arctan \left (\frac {\sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sqrt {2}}{2}\right )-66 \arctan \left (\frac {\sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sqrt {2}}{2}\right )\right ) \sqrt {2}}{24 d \sqrt {-\frac {2 \cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \sqrt {\frac {a \left (-1+\cos \left (d x +c \right )\right )}{\cos \left (d x +c \right )}}\, \sin \left (d x +c \right )^{3}}\) | \(367\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.80, size = 462, normalized size = 2.98 \begin {gather*} \left [\frac {8 \, \sqrt {2} A a \sqrt {-\frac {1}{a}} \log \left (-\frac {2 \, \sqrt {2} {\left (\cos \left (d x + c\right )^{2} + \cos \left (d x + c\right )\right )} \sqrt {\frac {a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right )}} \sqrt {-\frac {1}{a}} - {\left (3 \, \cos \left (d x + c\right ) + 1\right )} \sin \left (d x + c\right )}{{\left (\cos \left (d x + c\right ) - 1\right )} \sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - 11 \, A \sqrt {-a} \log \left (\frac {2 \, {\left (\cos \left (d x + c\right )^{2} + \cos \left (d x + c\right )\right )} \sqrt {-a} \sqrt {\frac {a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right )}} - {\left (2 \, a \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right )}{\sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - 2 \, {\left (2 \, A \cos \left (d x + c\right )^{3} + 7 \, A \cos \left (d x + c\right )^{2} + 5 \, A \cos \left (d x + c\right )\right )} \sqrt {\frac {a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right )}}}{8 \, a d \sin \left (d x + c\right )}, \frac {8 \, \sqrt {2} A \sqrt {a} \arctan \left (\frac {\sqrt {2} \sqrt {\frac {a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right )}} \cos \left (d x + c\right )}{\sqrt {a} \sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - 11 \, A \sqrt {a} \arctan \left (\frac {\sqrt {\frac {a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right )}} \cos \left (d x + c\right )}{\sqrt {a} \sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - {\left (2 \, A \cos \left (d x + c\right )^{3} + 7 \, A \cos \left (d x + c\right )^{2} + 5 \, A \cos \left (d x + c\right )\right )} \sqrt {\frac {a \cos \left (d x + c\right ) - a}{\cos \left (d x + c\right )}}}{4 \, a d \sin \left (d x + c\right )}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} A \left (\int \frac {\cos ^{2}{\left (c + d x \right )}}{\sqrt {- a \sec {\left (c + d x \right )} + a}}\, dx + \int \frac {\cos ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}}{\sqrt {- a \sec {\left (c + d x \right )} + a}}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 1.06, size = 141, normalized size = 0.91 \begin {gather*} \frac {\frac {8 \, \sqrt {2} A \arctan \left (\frac {\sqrt {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a}}{\sqrt {a}}\right )}{\sqrt {a}} - \frac {11 \, A \arctan \left (\frac {\sqrt {2} \sqrt {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a}}{2 \, \sqrt {a}}\right )}{\sqrt {a}} - \frac {\sqrt {2} {\left (3 \, {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a\right )}^{\frac {3}{2}} A + 10 \, \sqrt {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a} A a\right )}}{{\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a\right )}^{2}}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {{\cos \left (c+d\,x\right )}^2\,\left (A+\frac {A}{\cos \left (c+d\,x\right )}\right )}{\sqrt {a-\frac {a}{\cos \left (c+d\,x\right )}}} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________